package top.codingfly;

//import cn.hutool.core.map.MapUtil;
//import cn.hutool.db.Entity;
//import top.codingfly.config.Config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import top.codingfly.cto51.Cto51Scrapy;

import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Application {
    private static Set<String> programEnvs = new HashSet() {{ add("local"); add("test"); add("prod"); }};
    private static Logger logger = LoggerFactory.getLogger(Application.class);

    public static void main(String[] args) throws Exception {
        if (programEnvs.contains(System.getProperty("programEnv"))==false) {
            throw new RuntimeException("请配置 programEnv 参数，该参数取值只有 local，test 和 prod");
        }
        for (int i = 0; i < 3; i++) {
            logger.debug("debug===debug===debug===debug===debug");
            logger.info("info===info===info===info===info");
            logger.warn("warn===warn===warn===warn===warn");
            logger.error("error===error===error===error===error");
        }
        Cto51Scrapy.downloadCourse(34074);
//        List<Entity> list = Config.db.findAll("magic_api_info");
//        while (true) {
//            Thread.sleep(300);
//            String sql = "select * from magic_api_info where id in (:ids)";
//            Map<String, Object> paramMap = MapUtil.of("ids", new String[]{"033239e63a2a42b987567a37a2efdd32", "104219ceb2e34de38c1d4389cb0a094e", "180524e850124de7956d855bc94bcac9"});
//            paramMap.put("aaa", "bbb");
//            List<Entity> data = Config.db.query(sql, paramMap);
//            logger.info("==============>>>>>>>>>>>>>>>>>>"+System.currentTimeMillis());
//        }
    }

}
